/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.gui.rendering;

import net.groupme.model.Resource;
import net.groupme.model.ResourceVisualization;

/**
 * created on Jun 29, 2007
 * 
 * This {@link Renderer} implementation renders images...
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: mischa $
 * 
 * @version $Revision: 1.10 $ $Date: 2008-02-28 12:40:13 $
 */
public class ImageRenderer extends AbstractRenderer {

	/* (non-Javadoc)
	 * @see net.groupme.gui.rendering.AbstractRenderer#renderAsHTML(net.groupme.model.ResourceVisualization)
	 */
	@Override
	public String renderAsHTML(ResourceVisualization resourceVisualization, Integer groupWidth, Integer groupHeight, Integer zAxis) {
		String html = "";
		Resource resource = resourceVisualization.getResource();
		String width = "100px;";
		String widthMove = "100px;";
		if(resourceVisualization.getWidth() > 0){
			width = " width:" + (((resourceVisualization.getWidth()*groupWidth)/1000)-4) + "px;";
			widthMove = " width:" + (((resourceVisualization.getWidth()*groupWidth)/1000)) + "px;";
		}
		
		//div initialisierung
		html += this.getDivAttributes(resourceVisualization, groupWidth, groupHeight, zAxis);
		
		//menu:
		html += this.getMenu(resourceVisualization, resourceVisualization.getURI().toString(), groupWidth);
		
		html += "<strong>" + resource.getName() + "</strong>" + "<br/>"
				+ "<img  style=\"" + width + " min-width:130px; font-size:1.0em;\" id=\"" + resourceVisualization.getURI().toString() + "_content" + "\" src=\"" + resource.getURL().toString() + "\" alt=\"" + resource.getName() + "\"/>";

		//div open _tags
		html += "<div id=\"" + resourceVisualization.getURI().toString() + "_tags\" class=\"tag\" style=\"display:none;\">";
		//close div _tags
		html += "</div>";
		//close div URI
		html += "</div>";
		
		html += this.getMoveBar(resourceVisualization, widthMove);
		//close div _border
		html += "</div>";
		return html;
	}

}